let submit_info = document.getElementsByClassName("submit-success");
for(let info of submit_info){
    info.style.display = "none"
}



$('#signin_button').click(function(){
    for(let info of submit_info){
        info.style.display = "none"
    }

    if($("#formGroupExampleInput").val() == "" || $("#formGroupExampleInput2").val() == ""){
        submit_info[2].style.display = "block"
    }else {

        let contact = 0
        if ($("#inlineCheckbox3").get(0).checked) {
            contact = 1
        }

        $.ajax({
            type: "GET",
            url: "signin",
            data: {
                address:$("#formGroupExampleInput").val(),
                temperature:$("#formGroupExampleInput2").val(),
                remark:$("#formGroupExampleInput3").val(),
                contact:contact,
            },
            dataType: "json",
            success: function(data){
                if(data.msg == "ok"){
                    submit_info[0].style.display = "block"
                    setTimeout(function(){window.location.href = "find.jsp"},1500);
                }else{
                    submit_info[1].style.display = "block"

                }
            }
        });
    }
});

